package com.example.design.结构型设计模式.装饰器模式;

// 焦糖咖啡装饰器类
public class SugarDecorator extends CoffeeDecorator {

    public SugarDecorator(Coffee coffee) {
        super(coffee);
    }

    @Override
    public String getDescription() {
        return decoratedCoffee.getDescription() + ", 加糖";
    }

    @Override
    public double cost() {
        return decoratedCoffee.cost() + 0.2; // 加糖的价格
    }
}
